package com.example.demo.test.quartz;

import com.example.demo.service.ThreadPool.AsyncService;
import com.example.demo.utility.Quartz;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;

/**
 * 用工具类调用定时器例子
 *
 * @author yzh
 * @date 2022/11/21
 */
public class quartzTest2 implements Job {
    @Autowired
    AsyncService asyncService;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {


        try {
            Thread.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.err.println("当前时间：" + new Date());

    }


    public static void main(String[] args) {

        Quartz.addJob("test", 5, quartzTest2.class);


    }
}
